package controller;


import exception.BusiException;
import response.ResponseData;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import service.BaseService;

@RestController
@RequestMapping("/common")
public class BaseController {
    private final BaseService baseService;

    public BaseController(@Qualifier("baseService") BaseService baseService) {
        this.baseService = baseService;
    }

    @GetMapping("/dic")
    public ResponseData getDicList(String code) {
        if (code.equals("fieldType")) {
            throw new BusiException("发生了异常");
        }
        return ResponseData.success(baseService.getDicList(code));
    }
}
